class Solution {
    public boolean isValid(String s) {
        while(true){
            int l=s.length();
            s=s.replace("()","");
            s=s.replace("{}","");
            s=s.replace("[]","");
            if(s.length()==l){return l==0;}
        }
    }
}